using Godot;
using System;

public partial class City : Sprite2D
{
	[Signal]
	public delegate void OnClickEventHandler(City city);

	public BigMapCityData data = new();

	private Area2D area;
	public override void _Ready()
	{
		area = GetNode<Area2D>("Area2D");
		area.InputEvent += OnInputEvent;
		data.Name = "江夏";
	}

	private void OnInputEvent(Node viewport, InputEvent @event, long shapeIdx)
	{
		if (@event is InputEventMouseButton)
		{
			var ev = (InputEventMouseButton)@event;
			if (ev.ButtonIndex == MouseButton.Left && ev.IsPressed())
			{
				EmitSignal(SignalName.OnClick, this);
			}
		}
	}

}
